home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue34
/
clinic
/
KeyViolU.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-02-06
|
1KB
|
48 lines
unit KeyViolU;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, Grids, DBGrids, DB, DBTables;
type
TForm1 = class(TForm)
DataSource1: TDataSource;
Table1: TTable;
DBGrid1: TDBGrid;
procedure FormCreate(Sender: TObject);
public
procedure DoException(Sender: TObject; E: Exception);
end;
var
Form1: TForm1;
implementation
uses
DbiErrs;
{$R *.DFM}
procedure TForm1.DoException(Sender: TObject; E: Exception);
begin
if (E is EDBEngineError) and (EDBEngineError(E).Errors[0].ErrorCode = DbiErr_KeyViol) then
{ if (E is EDBEngineError) and
(EDBEngineError(E).Errors[0].ErrorCode = ErrBase_Integrity + ErrCode_KeyViol) then}
{ if (E is EDBEngineError) and
(EDBEngineError(E).Errors[0].Category = ErrCat_Integrity) and
(EDBEngineError(E).Errors[0].SubCode = ErrCode_KeyViol) then}
Caption := E.Message
else
Application.ShowException(E);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnException := DoException;
end;
end.